package com.ql.utils;

public class PageHelper {
	
	private int currentPageNo = 1;//当前页
	private int pageSize =  Constrants.PAGE_SIZE;//每页条数
	private int totalCount=0;//总条数
	private int totalPageCount=0;//总页数
	
	public int getCurrentPageNo() {
		if(this.currentPageNo < 1){
			this.currentPageNo = 1;
		}else if(this.currentPageNo > this.totalPageCount&&this.totalPageCount!=0){
			this.currentPageNo = this.totalPageCount;
		}
		return currentPageNo;
	}
	public void setCurrentPageNo(int currentPageNo) {
		if(currentPageNo > 0 ){
			this.currentPageNo = currentPageNo;
		}
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		if(totalCount > 0){
			this.totalCount = totalCount;
			setTotalPageCount();
		}
	}
	public int getTotalPageCount() {
		return totalPageCount;
	}
	public void setTotalPageCount() {
		this.totalPageCount = this.totalCount%this.pageSize==0?
				this.totalCount/this.pageSize:
					this.totalCount/this.pageSize+1;
	}
	
	

}
